DropDownListFor does not select value if using int[] as value
        Posted  
        
            by Iceman
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Iceman
        
        
        
        Published on 2010-04-13T16:40:32Z
        Indexed on 
            2010/04/13
            16:43 UTC
        
        
        Read the original article
        Hit count: 878
        
In my view
<%= Html.DropDownListFor( x => x.Countries[ i ], x.CountryList )%>
in my controller
public int[ ] Countries { get; set; }
public List<SelectListItem> CountryList { get; set; }
When the forms gets posted there is no problem, the dropdown is populated and the values the user selects are posted. But when I try to load the form with already assigned values to the Countries[ ] it does not get selected.
© Stack Overflow or respective owner